home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 2: CDPD 1 / Almathera Ten on Ten - Disc 2: CDPD 1.iso / pd / 076-100 / 079 / auxhandler / misc.c < prev    next >
C/C++ Source or Header  |  1995-03-13  |  2KB  |  82 lines

  1. /*
  2.  *  misc.c  - support routines - Phillip Lindsay (C) Commodore 1986
  3.  *  You may freely distribute this source and use it for Amiga Development -
  4.  *  as long as the Copyright notice is left intact.
  5.  *
  6.  * 30-SEP-86
  7.  *
  8.  */
  9. #include <functions.h>
  10. #include <stdio.h>
  11. #include <exec/types.h>
  12. #include <exec/nodes.h>
  13. #include <exec/lists.h>
  14. #include <exec/ports.h>
  15. #include <exec/libraries.h>
  16. #include <exec/devices.h>
  17. #include <exec/io.h>
  18. #include <exec/memory.h>
  19. #include <devices/console.h>
  20. #include <libraries/dos.h>
  21. #include <libraries/dosextens.h>
  22. #include <libraries/filehandler.h>
  23.  
  24. extern void returnpkt();
  25.  
  26. /* returnpkt() - packet support routine
  27.  * here is the guy who sends the packet back to the sender...
  28.  *
  29.  * (I modeled this just like the BCPL routine [so its a little redundant] )
  30.  */
  31.  
  32. void
  33. returnpktplain(packet, myproc)
  34. struct DosPacket *packet;
  35. struct Process *myproc;
  36. {
  37.     returnpkt(packet, myproc, packet->dp_Res1, packet->dp_Res2);
  38. }
  39.  
  40. void
  41. returnpkt(packet, myproc, res1, res2)
  42. struct DosPacket *packet;
  43. struct Process *myproc;
  44. ULONG  res1, res2;
  45. {
  46.     struct Message *mess;
  47.     struct MsgPort *replyport;
  48.  
  49.     packet->dp_Res1          = res1;
  50.     packet->dp_Res2          = res2;
  51.     replyport                = packet->dp_Port;
  52.     mess                     = packet->dp_Link;
  53.     packet->dp_Port          = &myproc->pr_MsgPort;
  54.     mess->mn_Node.ln_Name    = (char *) packet;
  55.     mess->mn_Node.ln_Succ    = NULL;
  56.     mess->mn_Node.ln_Pred    = NULL;
  57.     PutMsg(replyport, mess);
  58. }
  59.  
  60.  
  61. /*
  62.  * taskwait() ... Waits for a message to arrive at your port and
  63.  *   extracts the packet address which is returned to you.
  64.  */
  65.  
  66. struct DosPacket *
  67. taskwait(myproc)
  68. struct Process *myproc;
  69. {
  70.     struct MsgPort *myport;
  71.     struct Message *mymess;
  72.  
  73.     myport = &myproc->pr_MsgPort;
  74.     WaitPort(myport);
  75.     mymess = GetMsg(myport);
  76.     return((struct DosPacket *)mymess->mn_Node.ln_Name);
  77. }
  78.  
  79. /* end of misc.c    */
  80.  
  81.  
  82.